package com.zichen.pr.common.core.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zichen.pr.common.core.domain.BaseEntity;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;

/**
 * @program: pr
 * @description: 菜单权限
 * @author: rzhang
 * @create: 2021-04-01 15:19
 */
@Data
@TableName("sys_menu")
public class SysMenu extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 菜单ID */
    @TableId(value = "menu_id",type = IdType.AUTO)
    private Long menuId;

    /** 菜单名称 */
    @NotBlank(message = "菜单名称不能为空")
    @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
    @TableField(value = "menu_name")
    private String menuName;

    /** 父菜单名称 */
    @TableField(exist = false)
    private String parentName;

    /** 显示状态（0显示 1隐藏） */
    @TableField(value = "visible")
    private String visible;

    /** 父菜单ID */
    @TableField(value = "parent_id")
    private Long parentId;

    /** 组件路径 */
    @TableField(value = "component")
    private String component;

    /** 菜单图标 */
    @TableField(value = "icon")
    private String icon;

    /** 显示顺序 */
    @NotBlank(message = "显示顺序不能为空")
    @TableField(value = "order_num")
    private String orderNum;

    /** 路由地址 */
    @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
    @TableField(value = "path")
    private String path;

    /** 类型（M目录 C菜单 F按钮） */
    @NotBlank(message = "菜单类型不能为空")
    @TableField(value = "menu_type")
    private String menuType;

    /** 菜单状态（0显示 1隐藏） */
    @TableField(value = "status")
    private String status;

    /** 权限字符串 */
    @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
    @TableField(value = "perms")
    private String perms;

    /** 子菜单 */
    @TableField(exist = false)
    private List<SysMenu> children = new ArrayList<SysMenu>();
}
